﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Doves.DataAccessLayer.DAO;


namespace Doves.DataAccessLayer
{
    public interface IDALContext
    {
        ILink Link { get; }
        IZomby Zomby { get; }
        ILinkAnalizer LinkAnalizer { get; }
        IArticleAnalizer ArticleAnalizer { get; }
        IContentKilledChild ContentKilledChild { get; }
        IContentReplacing ContentReplacing { get; }
        IArticle Article { get; }
    }

    public class DALContext : IDALContext
    {
        private ILink _link;
        private IZomby _zomby;
        private ILinkAnalizer _linkAnalizer;
        private IArticleAnalizer _articleAnalizer;
        private IContentKilledChild _contentKilledChild;
        private IContentReplacing _contentReplacing;
        private IArticle _article;


        public ILink Link
        {
            get
            {
                if (_link == null)
                {
                    _link = new LinkDAO();
                }
                return _link;
            }
        }

        
        public IZomby Zomby
        {
            get
            {
                if (_zomby == null)
                {
                    _zomby = new ZombyDAO();
                }
                return _zomby;
            }
        }

        public ILinkAnalizer LinkAnalizer
        {
            get
            {
                if (_linkAnalizer == null)
                {
                    _linkAnalizer = new LinkAnalizerDAO();
                }
                return _linkAnalizer;
            }
        }


        public IArticleAnalizer ArticleAnalizer
        {
            get
            {
                if (_articleAnalizer == null)
                {
                    _articleAnalizer = new ArticleAnalizerDAO();
                }
                return _articleAnalizer;
            }
        }

        public IContentKilledChild ContentKilledChild
        {
            get
            {
                if (_contentKilledChild == null)
                {
                    _contentKilledChild = new ContentKilledChildDAO();
                }
                return _contentKilledChild;
            }
        }


        public IContentReplacing ContentReplacing
        {
            get
            {
                if (_contentReplacing == null)
                {
                    _contentReplacing = new ContentReplacingDAO();
                }
                return _contentReplacing;
            }
        }

        public IArticle Article
        {
            get
            {
                if (_article == null)
                {
                    _article = new ArticleDAO();
                }
                return _article;
            }
        }

    }
}
